import React, { useState } from 'react';
import { Modal, Icon, Button } from 'antd-mobile';
import Star from 'components/common/star';
import SelfCheckBox from 'components/common/selfCheckBox';

import './index.less';

// 多选弹框
export default function ModalCheck({ handleModal, visible, key, data }) {
  const [str, setStr] = useState('');
  const [valueStr, setValueStr] = useState('');
  function handleChange(i, v) {
    const _str = i + ',';
    const _valueStr = v + ',';
    setStr(_str.substring(0, _str.lastIndexOf(',')));
    setValueStr(_valueStr.substring(0, _valueStr.lastIndexOf(',')));
  }
  return (
    <>
      <Modal
        popup
        visible={visible}
        onClose={() => handleModal(str, valueStr)}
        animationType="slide-up"
        className="selfModal"
      >
        <SelfCheckBox data={data} handleChange={handleChange} />
        {/* <Button type='primary'>确定</Button> */}
      </Modal>
    </>
  );
}
